package com.itxx.homeWork.test;

public class Cat extends Animal  {

    public void catPush() {
        System.out.println("猫捉老鼠");
    }

    @Override
    public void eat() {

        System.out.println("猫吃了老鼠");
    }
}

class Test {
    public static void main(String[] args) {


        Animal a = new Cat();
        a.eat();
        //不能用子类特有方法
        //a.catPush;
        //向下转型,就可以用子类特有方法
        Cat c = (Cat) a;
        ((Cat) a).catPush();
    }
}